//@author A0087294-reused
#ifndef __singleton_h__
#define __singleton_h__

namespace logging {

    namespace detail {

        template <typename T>
        struct singleton
        {
          private:
            struct obj
            {
              obj() { singleton<T>::instance(); }
              inline void empty() const { }
            };
            static obj __obj;

            singleton();

          public:
            typedef T obj_type;

            static obj_type & instance()
            {
              static obj_type obj;

              __obj.empty();

              return obj;
            }
        };
        template <typename T>
        typename singleton<T>::obj
        singleton<T>::__obj;

    } /* detail */
} /* logging */

#endif